#include <iostream>
#include <cstring>
using namespace std;

const int N = 1e4 + 10;
int v[N], w[N], f[N], n, V;

int main()
{
    cin >> n >> V;
    for (int i = 0; i < n; i++)
        cin >> v[i];

    memset(f, 0x3f, sizeof(f));
    f[0] = 0;

    for (int i = 0; i < n; i++)
        for (int j = v[i]; j <= V; j++)
            f[j] = min(f[j], f[j - v[i]] + 1);

    if (f[V] > V)
        f[V] = -1;

    cout << f[V] << endl;
    return 0;
}